package org.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import java.awt.GraphicsEnvironment;

import javax.swing.*;

@SpringBootApplication
public class DataMigrationApplication {
    public static void main(String[] args) {
        // 检查是否为headless环境
        if (GraphicsEnvironment.isHeadless()) {
            System.err.println("错误：当前环境不支持图形界面");
            System.exit(1);
        }

        // 启动Spring Boot上下文
        ConfigurableApplicationContext context = SpringApplication.run(DataMigrationApplication.class, args);


        // 启动图形界面
        SwingUtilities.invokeLater(() -> {
            MainWindow mainWindow = new MainWindow();
            //MainWindow mainWindow = context.getBean(MainWindow.class);
            mainWindow.setVisible(true);
        });
    }
}